<?php
/* @var $this CompanyController */
/* @var $model Company */

    $this->breadcrumbs=array(
    	'Companies'=>array('index'),
    	$model->title,
    );

    $companyTag = CompanyTag::model()->findAll("companyid=:id", array(':id' => $model->id));
    $values = '';
    if(!empty($companyTag)){
        foreach($companyTag as  $v){
            $result =Tag::model()->find("id=:id", array(':id' => $v['tagid']));
            $values .= "<span  style='background: #DCE0EB;margin-left: 5px;padding: 4px 15px;width: auto;'>".$result->title."</span>";
        }
    }else{
        $values = '暂无分类';
    }


  if(Yii::app()->user->name=="admin"){ 
        $showview=array(
            'id',
            'username', 
            'title',
            'description',
            array(
                'name'=>'logo',
                'value'=>CHtml::image(".".$model->logo,$model->title,array("height"=>76)), 
                'type'=>'raw',   //这里是原型输出 
            ),
            //'hit',
             array(
                'name'=>'point',
                'value'=>($model->point)."条", 
            ),
           
            'address',
            'tel',
            'template',
            array(               // related city displayed as a link
                'label'=>'分类',
                'type'=>'raw',
                'value'=>CHtml::label($values,true),
            ),
        );
    }else{ 
         $showview=array( 
            'username', 
            'title',
            'description',
            array(
                'name'=>'logo',
                'value'=>CHtml::image(".".$model->logo,$model->title,array("height"=>76)), 
                'type'=>'raw',   //这里是原型输出 
            ),
            //'hit',
             array(
                'name'=>'point',
                'value'=>($model->point)."条", 
            ),
            'address',
            'tel',
            'template', 
        );
    }
?>

<h1>显示</h1>

<div class="Action">
    <?php if(Yii::app()->user->name=="admin"){?>
    <a href="<?php echo Yii::app()->request->urlReferrer; ?>"><img src="<?php echo Yii::app()->request->baseUrl; ?>/images/admin/jiantou.png" style=""></a>
    <?php } ?>
</div>

<?php $this->widget('zii.widgets.CDetailView', array(
	'data'=>$model,
    'itemCssClass'=>array('oddtablscss', 'eventablecss'),
	'attributes'=>$showview,
)); ?>
<?php if(Yii::app()->user->name!="admin"){?>
<div class="form"><?php echo CHtml::submitButton('修改信息',array('class'=>'subButton','onclick'=>'window.location.href="'.Yii::app()->createUrl('company/editinfo').'";')); ?></div>
 <?php } ?>
